package tool

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

const (
	success int = 1
	failed  int = 0
)

func Success(ctx *gin.Context, v interface{}) {
	ctx.JSON(http.StatusOK, map[string]interface{}{
		"code": success,
		"msg":  "成功",
		"data": v,
	})
}

func Failed(ctx *gin.Context, v interface{}) {
	ctx.JSON(http.StatusOK, map[string]interface{}{
		"code": failed,
		"msg":  "失败",
		"data": v,
	})
}
